package com.stylefeng.guns.common.transform;

import com.stylefeng.guns.common.VO.ComputerManageVO;
import com.stylefeng.guns.common.persistence.model.ComputerManage;

import java.util.ArrayList;
import java.util.List;
import java.util.Collections;

public class ComputerManageTransform {



    public static ComputerManageVO transform(ComputerManage computerManage){

        ComputerManageVO computerManageVO = new ComputerManageVO();
        computerManageVO.setId(computerManage.getId());
        computerManageVO.setPid(computerManage.getPid());
        computerManageVO.setItemname(computerManage.getItemname());
        computerManageVO.setTitle(computerManage.getTitle());
        computerManageVO.setPictureUrl(computerManage.getPictureUrl());
        computerManageVO.setCreatetime(computerManage.getCreatetime());
        computerManageVO.setModifiedtime(computerManage.getModifiedtime());
        computerManageVO.setComputerType(computerManage.getComputerType());
        return computerManageVO;
    }

    public static List<ComputerManageVO> transform(List<ComputerManage> computerManageVOList){
        if (computerManageVOList == null || computerManageVOList.isEmpty()){
            return Collections.emptyList();
        }
        List<ComputerManageVO> cds = new ArrayList<>();
        computerManageVOList.forEach(computerManage -> cds.add(transform(computerManage)));
        return cds;
    }
}
